const {
	db,
	dbCmd,
	result_success,
	result_error,
	appletInfoCollection,
	shopieCollection,
	userCollection
} = require('../../common/constants')
const {
	mainSpaceId
} = require('config-main-space')
module.exports = async function(params = {}) {
	const token = this.getUniIdToken()
	if (!token) {
		return result_error('登录失效,请重新登录')
	}
	let payload = await this.uniID.checkToken(token)
	if (payload.code) {
		return payload
	}
	let id = params._id
	if (!id) {
		return result_error('id错误')
	}
	let tdb = uniCloud.database({
		provider: 'tencent',
		spaceId: mainSpaceId
	})
	await db.collection('wmzmall-profitsharing').doc(id).remove()
	await tdb.collection('wmzmall-profitsharing').doc(id).remove()
	return result_success()
}